<?php
/**
 * @name /www/EditOrphanage.php
 * @author
 * @version 2011.04.5
 *
 * This is the page for Editing Orphanage Information by the Administrator.
 */

// Sets up configuration settings and includes libraries.
require_once('_ini.php');

// Libraries
ReqLib('/lib/private/Orphanage.php');


function DefineHeader() {
}

/**
 * Defines page content.
 *
 */
function DefineContent() {
  // Page content goes here.
  ?>
<p>
  <a href="<?=_webroot('/') ?>">Home</a>.
</p>
<?
	if($_SESSION['userId'] >0){
?>
		<p>
		  <a href="<?=_webroot('/account.php') ?>">My Account</a>.
		</p>
		<p>
		  <a href="<?=_webroot('/logout.php') ?>">Logout</a>.
		</p>
    <form  action = "orphanageRequestHandle.php" method="POST">
<center><table border="2">
	<tbody>
<?
	$o = new Orphanage();
	$orphanageId = $_REQUEST['oId'];

	//print($userId);/

	$o->Load($orphanageId);

	//print_r($u);
	//die();

	print('<tr><td>Orphanage ID</td><td><input type=text name=OrphanageId value="'.$o->OrphanageId.'" /></td></tr>');
	print('<tr><td>Orphanage Name</td><td><input type=text name=Name value="'.$o->Name.'" /></td></tr>');
	print('<tr><td>Contact Person\'s First Name</td><td><input type=text name=ContactFirstName value="'.$o->ContactFirstName.'" /></td></tr>');
	print('<tr><td>Contact Person\'sLast Name</td><td><input type=text name=ContactLastName value="'.$o->ContactLastName.'" /></td></tr>');
	print('<tr><td>Phone Number</td><td><input type=text name=ContactPhoneNumber value="'.$o->ContactPhoneNumber.'" /></td></tr>');
	print('<tr><td>Street 1</td><td><input type=text name=Street1 value="'.$o->Street1.'" /></td></tr>');
	print('<tr><td>Street 2</td><td><input type=text name=Street2 value="'.$o->Street2.'" /></td></tr>');
	print('<tr><td>Street 3</td><td><input type=text name=Street3 value="'.$o->Street3.'" /></td></tr>');
	print('<tr><td>City</td><td><input type=text name=City value="'.$o->City.'" /></td></tr>');
	print('<tr><td>State</td><td><input type=text name=State value="'.$o->State.'" /></td></tr>');
	print('<tr><td>Country</td><td><input type=text name=Country value="'.$o->Country.'" /></td></tr>');
	print('<tr><td>Postal Code</td><td><input type=text name=PostalCode value="'.$o->PostalCode.'" /></td></tr>');
	print('<tr><td>Notes</td><td><input type=text name=Notes value="'.$o->Notes.'" /></td></tr>');
	print('</tbody></table>');
  	print('<input type="submit" name="Action" value="Update Orphanage Info" />');
  	print('<input type="submit" name="Action" value="Delete Orphanage" />');
	print('<input type=button value="Back" onClick="history.go(-1)" />');
	print('</center>');

  	print('</form>');
	}
   else{
?>
		<p>
		  <a href="<?=_webroot('/login_register.php') ?>">Login/Register</a>.
		</p>
<?
   }
}

// Launches the page; without this, nothing happens.
require_once('_loader.php');